﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
using DotNetLib.IO;

namespace DotNetLib.Sample.Windows
{
  public partial class MainForm : Form
  {
    public MainForm()
    {
      this.InitializeComponent();
    }

    private void commandLink1_Click(object sender, EventArgs e)
    {
      MessageBox.Show("Here");
    }

    private void MainForm_Load(object sender, EventArgs e)
    {
      TreeNode stockControls = this.navigationTreeView.Nodes.Add("Stock .NET Controls");
      stockControls.Nodes.Add("Combo Box").Tag = typeof(ComboBoxSample);
      stockControls.Nodes.Add("List View").Tag = typeof(ListViewSample);
      stockControls.Nodes.Add("Tree View").Tag = typeof(TreeViewSample);

      TreeNode newControls = this.navigationTreeView.Nodes.Add("New Controls");
      newControls.Nodes.Add("Command Link").Tag = typeof(CommandLinkSample);
      newControls.Nodes.Add("Progress Dialog").Tag = typeof(ProgressDialogSample);
      newControls.Nodes.Add("Wizard").Tag = typeof(WizardSample);

      TreeNode utilities = this.navigationTreeView.Nodes.Add("Utilities");
      utilities.Nodes.Add("Single Instance").Tag = typeof(SingleInstanceSample);
    }

    private void navigationTreeView_AfterSelect(object sender, TreeViewEventArgs e)
    {
      Type uc = e.Node.Tag as Type;
      if (uc != null)
      {
        this.containerPanel.Controls.Clear();
        Control control = (Control)Activator.CreateInstance(uc);
        control.Dock = DockStyle.Fill;
        this.selectionHeaderLabel.Text = e.Node.Text;
        this.containerPanel.Controls.Add(control);
        control.Focus();
      }
    }

    private void logoPictureBox_Click(object sender, EventArgs e)
    {
      Process.Start("http://www.codeplex.com/DotNetLib");
    }
  }
}
